<template>
  <div>
    <detail-header></detail-header>
    <detail-banner :detailData="detailData"></detail-banner>
    <div class="content"></div>
  </div>
</template>

<script>
  import detailBanner from './components/Banner'
  import detailHeader from './components/Header'
  import axios from 'axios'

  export default {
    name: 'Detail',
    data (){
      return {
        detailData: {}
      }
    },
    methods: {
      getDetailInfo () {
        axios.get('/api/detail.json', {
          params: {id: this.$route.params.id}
        }).then(this.getDetailInfoSucc)
      },
      getDetailInfoSucc (res){
        res = res.data
        if (res.ret && res.data) {
          this.detailData = res.data
        }
      }
    },
    components: {
      detailBanner,
      detailHeader
    },
    mounted (){
      this.getDetailInfo()
    }
  }
</script>

<style lang="stylus" scoped>
  .content
    height: 50rem
</style>
